function cost1 = costfunction(param, pix, rss, fillvalue, pixnumber)
rss0 = param(1);
n = param(2);
pos = param(3:4);
d0 = sqrt(sum((pos * ones(1, pixnumber) - pix) .^ 2));
r0 = -(rss0 + 10 * n * log10(d0 / 100 * 1.5));
eff_pix_pos=find(rss~=fillvalue);
r=r0(eff_pix_pos)-rss(eff_pix_pos);
%cost1 = sum(r .^ 2) ;
cost1 = sum(abs(r)) ;
end
